import type { ClassifyWallList } from "./classify";
import type { Config } from "@/utils/request";
import { request } from "@/utils/request";
import { ref, toValue, watchEffect, type MaybeRefOrGetter } from "vue";

export const apiSearchWall = (
  data: { keyword: string; pageSize?: number; pageNum?: number },
  config?: Config
) => {
  return request<ClassifyWallList[]>("/searchWall", {
    data,
    ...config,
    catch: () => {
      return {
        data: Array(12)
          .fill({
            nickname: "全部",
            _id: "1234567",
            classid: "1234567",
            smallPicurl:
              "https://img2.baidu.com/it/u=3209353042,356122753&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500",
            description: `${Date.now()}`,
            tabs: ["好", "差"],
            score: "5",
          })
          .map((item) => ({ ...item, _id: item._id + Math.random() })),
        errCode: 0,
        errMsg: "",
      };
    },
  });
};
